package com.dubbo.api.consumer.controller;

import com.alibaba.fastjson.JSONObject;
import com.dubbo.api.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *  测试控制器
 *
 * @author 董帮辉
 * @date 2018/05/23
 */
@Controller
public class TestController {

    @Autowired
    TestService testService;

    /**
     * 测试json接口
     *
     * @param name
     * @return
     */
    @ResponseBody
    @RequestMapping("/test/{name}")
    public JSONObject testJson(@PathVariable("name") String name){
        JSONObject jsonObject = new JSONObject();
        String testStr = testService.sayHello(name);
        return jsonObject;
    }

}
